home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.ComponentAdapter;
- import java.awt.event.ComponentEvent;
- import javax.swing.JScrollBar;
- import javax.swing.JScrollPane;
- import javax.swing.Timer;
-
- public class BasicTreeUI$ComponentHandler extends ComponentAdapter implements ActionListener {
- // $FF: synthetic field
- private final BasicTreeUI this$0;
- protected Timer timer;
- protected JScrollBar scrollBar;
-
- public BasicTreeUI$ComponentHandler(BasicTreeUI var1) {
- this.this$0 = var1;
- }
-
- public void actionPerformed(ActionEvent var1) {
- if (this.scrollBar == null || !this.scrollBar.getValueIsAdjusting()) {
- if (this.timer != null) {
- this.timer.stop();
- }
-
- this.this$0.updateSize();
- this.timer = null;
- this.scrollBar = null;
- }
-
- }
-
- public void componentMoved(ComponentEvent var1) {
- if (this.timer == null) {
- JScrollPane var2 = this.getScrollPane();
- if (var2 == null) {
- this.this$0.updateSize();
- } else {
- this.scrollBar = var2.getVerticalScrollBar();
- if (this.scrollBar != null && this.scrollBar.getValueIsAdjusting()) {
- this.startTimer();
- } else if ((this.scrollBar = var2.getHorizontalScrollBar()) != null && this.scrollBar.getValueIsAdjusting()) {
- this.startTimer();
- } else {
- this.this$0.updateSize();
- }
- }
- }
-
- }
-
- protected JScrollPane getScrollPane() {
- Container var1;
- for(var1 = this.this$0.tree.getParent(); var1 != null && !(var1 instanceof JScrollPane); var1 = ((Component)var1).getParent()) {
- }
-
- return var1 instanceof JScrollPane ? (JScrollPane)var1 : null;
- }
-
- protected void startTimer() {
- if (this.timer == null) {
- this.timer = new Timer(200, this);
- this.timer.setRepeats(true);
- }
-
- this.timer.start();
- }
- }
-